package org.annotationz.lambda_test;

import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;

public class Test {


    public static void main(String[] args) {
        useConverter(UserDto::getName, "张三");
        useConverter(UserDto::getAge, "18");
    }

    private static void useConverter(Eq eq, String name) {
        Map<String, Object> map = new HashMap<>();
        // 代理 eq 方式
        EqInvoicationHandler invoicationHandler = new EqInvoicationHandler(eq, map);
        Eq eqProxy = (Eq) Proxy.newProxyInstance(Eq.class.getClassLoader(), new Class<?>[]{Eq.class}, invoicationHandler);

        // 使用代理实现
        Object eq1 = eqProxy.eq(new UserDto());
        System.out.println("eq1 = " + eq1 + "--->" + name);


    }


}
